package com.incross.dawin.http.parser;

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.NodeList;

import com.incross.dawin.objects.AdInfos;
import com.incross.dawin.util.BKLog;
import com.incross.dawin.util.CommonUtils;

public class IconInfoParser {
	
	public static final int ICON_FACEBOOK = 100;
	public static final int ICON_TWITTER = 200;
	public static final int ICON_SKIP = 400;
	public static final int ICON_SKIP_DESCRIPTION = 401;
	public static final int ICON_EVENT = 500;
	public static final int ICON_MAP = 600;
	public static final int ICON_DOWNLOAD = 700;
	public static final int ICON_CALL = 800;
	public static final int ICON_SNS_SHARE = 900;
	public static final int ICON_SNS_CANCEL = 910;
	
	private int mActionMode = AdInfos.ACTION_MODE_NONE;
	
	// Icon for Facebook
	private boolean mIsFacebookAvailable = false;
	private boolean mIsFacebookShowDirectly = false;
	private String mFacebookIconUrl = "";
	private String mFacebookClickThrough = "";
	private String mFacebookClickTracking = "";
	private int mFacebookShowTime = 0;
	
	
	// Icon for Twitter
	private boolean mIsTwitterAvailable = false;
	private boolean mIsTwitterShowDirectly = false;
	private String mTwitterIconUrl = "";
	private String mTwitterClickThrough = "";
	private String mTwitterClickTracking = "";
	private int mTwitterShowTime = 0;
	
	// Icon for Event
	private boolean mIsEventAvailable = false;
	private boolean mIsEventShowDirectly = false;
	private String mEventIconUrl = "";
	private String mEventClickThrough = "";
	private String mEventClickTracking = "";
	private int mEventShowTime = 0;
	
	// Icon for Map
	private boolean mIsMapAvailable = false;
	private boolean mIsMapShowDirectly = false;
	private String mMapIconUrl = "";
	private String mMapClickThrough = "";
	private String mMapClickTracking = "";
	private int mMapShowTime = 0;
	
	// Icon for Download
	private boolean mIsDownloadAvailable = false;
	private boolean mIsDownloadShowDirectly = false;
	private String mDownloadIconUrl = "";
	private String mDownloadClickThrough = "";
	private String mDownloadClickTracking = "";
	private int mDownloadShowTime = 0;
	
	// Icon for Call
	private boolean mIsCallAvailable = false;
	private boolean mIsCallShowDirectly = false;
	private String mCallIconUrl = "";
	private String mCallClickThrough = "";
	private String mCallClickTracking = "";
	private int mCallShowTime = 0;
	
	// Icon for skip
	private String mSkipIconUrl = "";
	private int mSkipShowTime = -1;
	private boolean mIsSkipAvailable = false;
	private boolean mIsSkipShowDirectly = false;
	
	// Icon for skip description.. 20140919 추가 아이콘 스킵 설명 이미지 
	private String mSkipDescriptionIconUrl = "";
	private int mSkipDescriptionShowTime = -1;
	private boolean mIsSkipDescriptionAvailable = false;
	private boolean mIsSkipDescriptionShowDirectly = false;
	
	// 20141008 다윈 고도화 sns share icon 추가
	private String mSnsShareButtonIconUrl = "";
	private int mSnsShareButtonShowTime = -1;
	private boolean mIsSnsShareAvailable = false;
	private boolean mIsSnsShareShowDirectly = false;
	
	// 20141020 다윈 고도화 sns share cancel icon 추가
	private String mSnsShareCancelIconUrl = "";
	private int mSnsShareCancelIconShowTime = -1;
	private boolean mIsSnsShareCancelIconAvailable = false;
	private boolean mIsSnsShareCancelIconShowDirectly = false;
	
	// 20141216 파싱시 발생한 문제 체크용 boolean값 추가
	private boolean mIsParsingProblemOccured = false;
	
	public IconInfoParser(NodeList iconList) {
		if(iconList != null) {
			try {
				NodeList snsList = iconList.item(0).getChildNodes();
				
				for(int i = 0; i < snsList.getLength(); i++) {
					if(snsList.item(i).getFirstChild() != null) {
						NamedNodeMap attributes = snsList.item(i).getAttributes();
						
						String program = "";
						int showTime = 0;
						
						for(int x = 0; x < attributes.getLength(); x++) {
							
							if(attributes.item(x).getNodeName().equals("program")) {
								program = attributes.item(x).getNodeValue();
							} else if(attributes.item(x).getNodeName().equals("vt")) {
								showTime = (CommonUtils.isNumber(attributes.item(x).getNodeValue())?Integer.parseInt(attributes.item(x).getNodeValue()): 0);
								if(showTime > 0) {
									showTime *= 1000;
								} else {
									if(showTime < 0) {
										showTime = -1;
									}
								}
							}
						}
						
						// 20140919 me2day 서비스 종료로 인해 me2day관련 삭제함.
						if(program.equals("facebook")) {
							mFacebookShowTime = showTime;
							initFacebook(snsList.item(i).getChildNodes());
							if(showTime == 0) {
								mIsFacebookShowDirectly = true;
							}
						} else if(program.equals("twitter")) {
							mTwitterShowTime = showTime;
							initTwitter(snsList.item(i).getChildNodes());
							if(showTime == 0) {
								mIsTwitterShowDirectly = true;
							}
						} else if(program.equals("skip")) {
							mSkipShowTime = showTime;
							getSkipIcon(snsList.item(i).getChildNodes());
							if(showTime == 0) {
								mIsSkipShowDirectly = true;
							}
						} else if(program.equals("skip_description")) {
							// 20140919 스킵설명버튼 이미지 가져오는부분 추가
							mSkipDescriptionShowTime = showTime;
							getSkipDescriptionIcon(snsList.item(i).getChildNodes());
							if(showTime == 0) {
								mIsSkipDescriptionShowDirectly = true;
							}
						} else if(program.equals("event") || program.equals("url_home") || program.equals("url_click") || program.equals("url_download")) {
							// 20141024 다윈 고도화 : event와동일하게 landing url을 아이콘에 따라 분리한 것으로 event와 동일하게 웹 페이지에 landing 시키는 것으로 한다.
							mEventShowTime = showTime;
							initEvent(snsList.item(i).getChildNodes());
							if(showTime == 0) {
								mIsEventShowDirectly = true;
							}
						} else if(program.equals("download")) {
							mDownloadShowTime = showTime;
							initDownload(snsList.item(i).getChildNodes());
							if(showTime == 0) {
								mIsDownloadShowDirectly = true;
							}
						} else if(program.equals("map")) {
							mMapShowTime = showTime;
							initMap(snsList.item(i).getChildNodes());
							if(showTime == 0) {
								mIsMapShowDirectly = true;
							}
						} else if(program.equals("call")) {
							mCallShowTime = showTime;
							initCall(snsList.item(i).getChildNodes());
							if(showTime == 0) {
								mIsCallShowDirectly = true;
							}
						} else if(program.equals("snsShare")) {
							mSnsShareButtonShowTime = showTime;
							getSnsShareIcon(snsList.item(i).getChildNodes());
							if(showTime == 0) {
								mIsSnsShareShowDirectly = true;
							}
						} else if(program.equals("snsShareCancel")) {
							mSnsShareCancelIconShowTime = showTime;
							getSnsShareCancelIcon(snsList.item(i).getChildNodes());
							if(showTime == 0) {
								mIsSnsShareCancelIconShowDirectly = true;
							}
						}
					}
				}
			} catch(Exception e) {
				e.printStackTrace();
				mIsParsingProblemOccured = true;
			}
		} else {
			mIsParsingProblemOccured = true;
		}
	}
	
	private void initFacebook(NodeList nodeList) {
		mActionMode = AdInfos.ACTION_MODE_SNS;
		mIsFacebookAvailable = true;
		for(int i = 0; i < nodeList.getLength(); i++) {
			if(nodeList.item(i) != null) {
				
				if(nodeList.item(i).getNodeName().equals("Resource")) {
					
					NodeList res = nodeList.item(i).getChildNodes();
					for(int j = 0; j < res.getLength(); j++) {
						if(res.item(j).getNodeName().equals("StaticResource")) {
							mFacebookIconUrl = res.item(i).getFirstChild().getNodeValue();
							BKLog.i("static resource : " + mFacebookIconUrl);
							break;
						}
					}
					
				} else if(nodeList.item(i).getNodeName().equals("IconClicks")) {
					
					NodeList iconClicks = nodeList.item(i).getChildNodes();
					for(int j = 0; j < iconClicks.getLength(); j++) {
						if(iconClicks.item(j).getNodeName().equals("IconClickThrough")) {
							mFacebookClickThrough = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click through : " + mFacebookClickThrough);
						} else if(iconClicks.item(j).getNodeName().equals("IconClickTracking")) {
							mFacebookClickTracking = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click tracking : " + mFacebookClickTracking);
						}
					}
				}
			}
		}
		
	}
	
	private void initTwitter(NodeList nodeList) {
		mActionMode = AdInfos.ACTION_MODE_SNS;
		mIsTwitterAvailable = true;
		for(int i = 0; i < nodeList.getLength(); i++) {
			if(nodeList.item(i) != null) {
				
				if(nodeList.item(i).getNodeName().equals("Resource")) {
					
					NodeList res = nodeList.item(i).getChildNodes();
					for(int j = 0; j < res.getLength(); j++) {
						if(res.item(j).getNodeName().equals("StaticResource")) {
							mTwitterIconUrl = res.item(i).getFirstChild().getNodeValue();
							BKLog.i("static resource : " + mTwitterIconUrl);
							break;
						}
					}
					
				} else if(nodeList.item(i).getNodeName().equals("IconClicks")) {
					
					NodeList iconClicks = nodeList.item(i).getChildNodes();
					for(int j = 0; j < iconClicks.getLength(); j++) {
						if(iconClicks.item(j).getNodeName().equals("IconClickThrough")) {
							mTwitterClickThrough = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click through : " + mTwitterClickThrough);
						} else if(iconClicks.item(j).getNodeName().equals("IconClickTracking")) {
							mTwitterClickTracking = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click tracking : " + mTwitterClickTracking);
						}
					}
				}
			}
		}
	}
	
	
	private void initEvent(NodeList nodeList) {
		mActionMode = AdInfos.ACTION_MODE_EVENT;
		mIsEventAvailable = true;
		for(int i = 0; i < nodeList.getLength(); i++) {
			if(nodeList.item(i) != null) {
				
				if(nodeList.item(i).getNodeName().equals("Resource")) {
					
					NodeList res = nodeList.item(i).getChildNodes();
					for(int j = 0; j < res.getLength(); j++) {
						if(res.item(j).getNodeName().equals("StaticResource")) {
							mEventIconUrl = res.item(i).getFirstChild().getNodeValue();
							BKLog.i("static resource : " + mEventIconUrl);
							break;
						}
					}
					
				} else if(nodeList.item(i).getNodeName().equals("IconClicks")) {
					
					NodeList iconClicks = nodeList.item(i).getChildNodes();
					for(int j = 0; j < iconClicks.getLength(); j++) {
						if(iconClicks.item(j).getNodeName().equals("IconClickThrough")) {
							mEventClickThrough = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click through : " + mEventClickThrough);
						} else if(iconClicks.item(j).getNodeName().equals("IconClickTracking")) {
							mEventClickTracking = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click tracking : " + mEventClickTracking);
						}
					}
				}
			}
		}
	}
	
	private void initDownload(NodeList nodeList) {
		mActionMode = AdInfos.ACTION_MODE_DOWNLOAD;
		mIsDownloadAvailable = true;
		for(int i = 0; i < nodeList.getLength(); i++) {
			if(nodeList.item(i) != null) {
				
				if(nodeList.item(i).getNodeName().equals("Resource")) {
					
					NodeList res = nodeList.item(i).getChildNodes();
					for(int j = 0; j < res.getLength(); j++) {
						if(res.item(j).getNodeName().equals("StaticResource")) {
							mDownloadIconUrl = res.item(i).getFirstChild().getNodeValue();
							BKLog.i("download icon static resource : " + mDownloadIconUrl);
							break;
						}
					}
					
				} else if(nodeList.item(i).getNodeName().equals("IconClicks")) {
					
					NodeList iconClicks = nodeList.item(i).getChildNodes();
					for(int j = 0; j < iconClicks.getLength(); j++) {
						if(iconClicks.item(j).getNodeName().equals("IconClickThrough")) {
							mDownloadClickThrough = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click through : " + mDownloadClickThrough);
						} else if(iconClicks.item(j).getNodeName().equals("IconClickTracking")) {
							mDownloadClickTracking = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click tracking : " + mDownloadClickTracking);
						}
					}
				}
			}
		}
	}
	
	private void initMap(NodeList nodeList) {
		mActionMode = AdInfos.ACTION_MODE_MAP;
		mIsMapAvailable = true;
		for(int i = 0; i < nodeList.getLength(); i++) {
			if(nodeList.item(i) != null) {
				
				if(nodeList.item(i).getNodeName().equals("Resource")) {
					
					NodeList res = nodeList.item(i).getChildNodes();
					for(int j = 0; j < res.getLength(); j++) {
						if(res.item(j).getNodeName().equals("StaticResource")) {
							mMapIconUrl = res.item(i).getFirstChild().getNodeValue();
							BKLog.i("static resource : " + mMapIconUrl);
							break;
						}
					}
					
				} else if(nodeList.item(i).getNodeName().equals("IconClicks")) {
					
					NodeList iconClicks = nodeList.item(i).getChildNodes();
					for(int j = 0; j < iconClicks.getLength(); j++) {
						if(iconClicks.item(j).getNodeName().equals("IconClickThrough")) {
							mMapClickThrough = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click through : " + mMapClickThrough);
						} else if(iconClicks.item(j).getNodeName().equals("IconClickTracking")) {
							mMapClickTracking = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click tracking : " + mMapClickTracking);
						}
					}
				}
			}
		}
	}
	
	private void initCall(NodeList nodeList) {
		mActionMode = AdInfos.ACTION_MODE_CALL;
		mIsCallAvailable = true;
		for(int i = 0; i < nodeList.getLength(); i++) {
			if(nodeList.item(i) != null) {
				
				if(nodeList.item(i).getNodeName().equals("Resource")) {
					
					NodeList res = nodeList.item(i).getChildNodes();
					for(int j = 0; j < res.getLength(); j++) {
						if(res.item(j).getNodeName().equals("StaticResource")) {
							mCallIconUrl = res.item(i).getFirstChild().getNodeValue();
							break;
						}
					}
				} else if(nodeList.item(i).getNodeName().equals("IconClicks")) {
					
					NodeList iconClicks = nodeList.item(i).getChildNodes();
					for(int j = 0; j < iconClicks.getLength(); j++) {
						if(iconClicks.item(j).getNodeName().equals("IconClickThrough")) {
							mCallClickThrough = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click through : " + mCallClickThrough);
						} else if(iconClicks.item(j).getNodeName().equals("IconClickTracking")) {
							mCallClickTracking = iconClicks.item(j).getFirstChild().getNodeValue();
							BKLog.i("icon click tracking : " + mCallClickTracking);
						}
					}
				}
			}
		}
	}
	
	// 20141216 파싱시 문제가 발생한 경우 체크를 위한 메소드 추가
	public boolean isParsingProblemOccured() {
		return mIsParsingProblemOccured;
	}
	
	private void getSkipIcon(NodeList nodeList) {
		if(mSkipShowTime < 0) {
			mIsSkipAvailable = false;
		} else {
			mIsSkipAvailable = true;
			for(int i = 0; i < nodeList.getLength(); i++) {
				if(nodeList.item(i) != null) {
					
					if(nodeList.item(i).getNodeName().equals("Resource")) {
						
						NodeList res = nodeList.item(i).getChildNodes();
						for(int j = 0; j < res.getLength(); j++) {
							if(res.item(j).getNodeName().equals("StaticResource")) {
								mSkipIconUrl = res.item(i).getFirstChild().getNodeValue();
								break;
							}
						}
					}
				}
			}
		}
	}
	
	// 20140919 스킵설명버튼 이미지 가져오는부분 추가
	private void getSkipDescriptionIcon(NodeList nodeList) {
		if(mSkipShowTime < 0) {
			mIsSkipDescriptionAvailable = false;
		} else {
			mIsSkipDescriptionAvailable = true;
			for(int i = 0; i < nodeList.getLength(); i++) {
				if(nodeList.item(i) != null) {
					
					if(nodeList.item(i).getNodeName().equals("Resource")) {
						
						NodeList res = nodeList.item(i).getChildNodes();
						for(int j = 0; j < res.getLength(); j++) {
							if(res.item(j).getNodeName().equals("StaticResource")) {
								mSkipDescriptionIconUrl = res.item(i).getFirstChild().getNodeValue();
								break;
							}
						}
						
					}
				}
			}
		}
	}
	
	// 20141008 다윈 고도화. 액션 버튼과 관계없이 icon 범주에 추가된 아이콘. skip 및 skip description과 같이 처리함.
	private void getSnsShareIcon(NodeList nodeList) {
		if(mSnsShareButtonShowTime < 0) {
			mIsSnsShareAvailable = false;
		} else {
			mIsSnsShareAvailable = true;
			for(int i = 0; i < nodeList.getLength(); i++) {
				if(nodeList.item(i) != null) {
					
					if(nodeList.item(i).getNodeName().equals("Resource")) {
						
						NodeList res = nodeList.item(i).getChildNodes();
						for(int j = 0; j < res.getLength(); j++) {
							if(res.item(j).getNodeName().equals("StaticResource")) {
								mSnsShareButtonIconUrl = res.item(i).getFirstChild().getNodeValue();
								break;
							}
						}
						
					}
				}
			}
		}
		BKLog.e("################################################################################");
		BKLog.e("sns share icon!! : " + mSnsShareButtonIconUrl);
		BKLog.e("################################################################################");
	}
	
	private void getSnsShareCancelIcon(NodeList nodeList) {
		if(mSnsShareCancelIconShowTime < 0) {
			mIsSnsShareCancelIconAvailable = false;
		} else {
			mIsSnsShareCancelIconAvailable = true;
			for(int i = 0; i < nodeList.getLength(); i++) {
				if(nodeList.item(i) != null) {
					
					if(nodeList.item(i).getNodeName().equals("Resource")) {
						
						NodeList res = nodeList.item(i).getChildNodes();
						for(int j = 0; j < res.getLength(); j++) {
							if(res.item(j).getNodeName().equals("StaticResource")) {
								mSnsShareCancelIconUrl = res.item(i).getFirstChild().getNodeValue();
								break;
							}
						}
						
					}
				}
			}
		}
		BKLog.e("################################################################################");
		BKLog.e("sns share cancel icon!! : " + mSnsShareCancelIconUrl);
		BKLog.e("################################################################################");
	}
	
	public boolean isAvailable(int which) {
		boolean result = false;
		switch(which) {
			case ICON_FACEBOOK:
				result = mIsFacebookAvailable;
				break;
				
			case ICON_TWITTER:
				result = mIsTwitterAvailable;
				break;
				
			case ICON_EVENT:
				result = mIsEventAvailable;
				break;
				
			case ICON_DOWNLOAD:
				result = mIsDownloadAvailable;
				break;
				
			case ICON_MAP:
				result = mIsMapAvailable;
				break;
				
			case ICON_CALL:
				result = mIsCallAvailable;
				break;
				
			case ICON_SKIP:
				result = mIsSkipAvailable;
				break;
				
			case ICON_SKIP_DESCRIPTION:
				result = mIsSkipDescriptionAvailable;
				break;
				
			case ICON_SNS_SHARE:
				result = mIsSnsShareAvailable;
				break;
				
			case ICON_SNS_CANCEL:
				result = mIsSnsShareCancelIconAvailable;
				break;
		}
		
		return result;
	}
	
	public boolean isIconShowDirectly(int which) {
		boolean result = false;
		switch(which) {
			case ICON_FACEBOOK:
				result = mIsFacebookShowDirectly;
				break;
				
			case ICON_TWITTER:
				result = mIsTwitterShowDirectly;
				break;
				
			case ICON_EVENT:
				result = mIsEventShowDirectly;
				break;
				
			case ICON_DOWNLOAD:
				result = mIsDownloadShowDirectly;
				break;
				
			case ICON_MAP:
				result = mIsMapShowDirectly;
				break;
				
			case ICON_CALL:
				result = mIsCallShowDirectly;
				break;
				
			case ICON_SKIP:
				result = mIsSkipShowDirectly;
				break;
				
			case ICON_SKIP_DESCRIPTION:
				result = mIsSkipDescriptionShowDirectly;
				break;
				
			case ICON_SNS_SHARE:
				result = mIsSnsShareShowDirectly;
				break;
				
			case ICON_SNS_CANCEL:
				result = mIsSnsShareCancelIconShowDirectly;
				break;
		}
		
		return result;
	}
	
	public String getIconUrl(int which) {
		String result = null;
		switch(which) {
			case ICON_FACEBOOK:
				result = mFacebookIconUrl;
				break;
				
			case ICON_TWITTER:
				result = mTwitterIconUrl;
				break;
				
			case ICON_SKIP:
				result = mSkipIconUrl;
				break;
				
			case ICON_SKIP_DESCRIPTION:
				result = mSkipDescriptionIconUrl;
				break;
				
			case ICON_EVENT:
				result = mEventIconUrl;
				break;
				
			case ICON_DOWNLOAD:
				result = mDownloadIconUrl;
				break;
				
			case ICON_MAP:
				result = mMapIconUrl;
				break;
				
			case ICON_CALL:
				result = mCallIconUrl;
				break;
				
			case ICON_SNS_SHARE:
				result = mSnsShareButtonIconUrl;
				break;
				
			case ICON_SNS_CANCEL:
				result = mSnsShareCancelIconUrl;
				break;
		}
		
		return result;
	}
	
	public int getIconShowTime(int which) {
		int result = 0;
		switch(which) {
			case ICON_FACEBOOK:
				result = mFacebookShowTime;
				break;
				
			case ICON_TWITTER:
				result = mTwitterShowTime;
				break;
				
			case ICON_SKIP:
				result = mSkipShowTime;
				break;
				
			case ICON_SKIP_DESCRIPTION:
				result = mSkipDescriptionShowTime;
				break;
				
			case ICON_EVENT:
				result = mEventShowTime;
				break;
				
			case ICON_DOWNLOAD:
				result = mDownloadShowTime;
				break;
				
			case ICON_MAP:
				result = mMapShowTime;
				break;
				
			case ICON_CALL:
				result = mCallShowTime;
				break;
				
			case ICON_SNS_SHARE:
				result = mSnsShareButtonShowTime;
				break;
				
			case ICON_SNS_CANCEL:
				result = mSnsShareCancelIconShowTime;
				break;
		}
		
		return result;
	}
	
	public String getClickThrough(int which) {
		String result = null;
		switch(which) {
			case ICON_FACEBOOK:
				result = mFacebookClickThrough;
				break;
				
			case ICON_TWITTER:
				result = mTwitterClickThrough;
				break;
				
			case ICON_EVENT:
				result = mEventClickThrough;
				break;
				
			case ICON_DOWNLOAD:
				result = mDownloadClickThrough;
				break;
				
			case ICON_MAP:
				result = mMapClickThrough;
				break;
				
			case ICON_CALL:
				result = mCallClickThrough;
				break;
		}
		
		return result;
	}
	
	public String getTrackingUrl(int which) {
		String result = null;
		switch(which) {
			case ICON_FACEBOOK:
				result = mFacebookClickTracking;
				break;
				
			case ICON_TWITTER:
				result = mTwitterClickTracking;
				break;
				
			case ICON_EVENT:
				result = mEventClickTracking;
				break;
				
			case ICON_DOWNLOAD:
				result = mDownloadClickTracking;
				break;
				
			case ICON_MAP:
				result = mMapClickTracking;
				break;
				
			case ICON_CALL:
				result = mCallClickTracking;
				break;
		}
		
		return result;
	}
	
	public int getActionButtonMode() {
		return mActionMode;
	}

}
